package com.ctbri.gui;

import java.awt.FlowLayout;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

import com.ctbri.util.SwingConsole;

public class Ex10 extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JButton button = new JButton("button1");
	JTextField textField = new JTextField(10);
	JApplet applet = new JApplet();
	
	public Ex10() {
		
		button.addFocusListener(new FocusAdapter() {
			
			@Override
			public void focusGained(FocusEvent arg0) {
				textField.setText(button.getText());
			}
		});
		applet.setLayout(new FlowLayout());
		applet.add(textField);
		applet.add(button);
		add(applet);
	}

	public static void main(String[] args) {
		SwingConsole.run(new Ex10(), 500, 500);
	}

}
